package day230510;

import java.util.Scanner;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * @date 2023/5/10 17:09
 * 字符串计数
 */
public class Main01 {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNext()) {
            StringBuilder s1 = new StringBuilder(scan.next());
            StringBuilder s2 = new StringBuilder(scan.next());
            int len1 = scan.nextInt();
            int len2 = scan.nextInt();
            // 同步长度到 len2, s1 后补 a, s2 后补 z+1
            for (int i = s1.length(); i < len2; i++) {
                s1.append('a');
            }
            for (int i = s2.length(); i < len2; i++) {
                s2.append('z' + 1);
            }
            // 计算对应位置的差值
            int[] differenceValue = new int[len2];
            for (int i = 0; i < len2; i++) {
                differenceValue[i] = s2.charAt(i) - s1.charAt(i);
            }
            // 计算结果
            int result = 0;
            for (int i = len1; i <= len2; i++) {
                for (int j = 0; j < i; j++) {
                    result += differenceValue[j] * Math.pow(26, i - j - 1);
                }
            }
            System.out.println(((result - 1) % 1000007));
        }
        scan.close();
    }
}
